package com.example.demo.servlet;

import com.example.demo.dao.OrdersDao;
import com.example.demo.entity.OrdersVo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet("/findOderBylwc")
public class FindOderBylwc extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String search = req.getParameter("search");
        try{
            List<OrdersVo> orderbooks = new OrdersDao().findOrders(search);
            System.out.println(orderbooks);
            req.setAttribute("orderDetail",orderbooks);
            req.getRequestDispatcher("/order.jsp").forward(req,resp);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
